import MusicManager from "../../../../MusicManager";
import { Killer } from "../../../funcObj/interface/HealthPoint";
import FlyerMissile from "../FlyerMissile";

const { ccclass, property } = cc._decorator;

/**
 * 照明弹
 */
@ccclass
export default class Flare extends FlyerMissile {

    _angle: number = 0;

    public get angle(): number {
        return this._angle;
    }

    public set angle(v: number) {
        this._angle = v;
    }

    protected preDispatch(): void {
        MusicManager.instance.play(MusicManager.instance.iproFire, this.node);
        cc.tween(this.node)
            .by(0.5, { angle: 360 })
            .repeatForever()
            .start();
    }

    die(killer: Killer): void {
        this.node.stopAllActions();
        super.die(killer);
    }

    onArrive(): void {
        MusicManager.instance.play(MusicManager.instance.iproBomb, this.node);
        super.onArrive();
    }

}
